package org.world.api.sheep.command.request;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import org.mc.ddd.domain.Assembler;
import org.mc.ddd.infrastructure.util.ObjectConverter;
import org.world.domain.aggregate.animal.constant.GenderEnum;
import org.world.domain.aggregate.sheep.entity.Sheep;

import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;

@Data
@ApiModel
public class CreateSheepDto implements Assembler<Sheep> {
    /**
     * 名称
     */
    @NotNull
    private String name;

    /**
     * 性别
     */
    @NotNull
    private GenderEnum gender;

    /**
     * 是否怀孕
     */
    @NotNull
    private Boolean isPregnant;

    /**
     * 出生时间
     */
    @NotNull
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime gaveBirthTime;

    /**
     * 是否有角
     */
    @NotNull
    private Boolean hasHorn;

    @Override
    public Sheep transform() {
        return ObjectConverter.convert(this, Sheep.class);
    }
}
